package com.ktgj.customer.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.customer.domain.CaseComplaintReimb;
import com.ktgj.customer.service.ICaseComplaintReimbService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 投诉工单_投诉赔偿结果Controller
 * 
 * @author ruoyi
 * @date 2022-05-27
 */
@RestController
@RequestMapping("/laintReimb")
public class CaseComplaintReimbController extends BaseController
{
    @Autowired
    private ICaseComplaintReimbService caseComplaintReimbService;

    /**
     * 查询投诉工单_投诉赔偿结果列表
     */
    @PreAuthorize(hasPermi = "system:reimb:list")
    @GetMapping("/list")
    public TableDataInfo list(CaseComplaintReimb caseComplaintReimb)
    {
        startPage();
        List<CaseComplaintReimb> list = caseComplaintReimbService.selectCaseComplaintReimbList(caseComplaintReimb);
        return getDataTable(list);
    }

    /**
     * 导出投诉工单_投诉赔偿结果列表
     */
    @PreAuthorize(hasPermi = "system:reimb:export")
    @Log(title = "投诉工单_投诉赔偿结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CaseComplaintReimb caseComplaintReimb) throws IOException
    {
        List<CaseComplaintReimb> list = caseComplaintReimbService.selectCaseComplaintReimbList(caseComplaintReimb);
        ExcelUtil<CaseComplaintReimb> util = new ExcelUtil<CaseComplaintReimb>(CaseComplaintReimb.class);
        util.exportExcel(response, list, "投诉工单_投诉赔偿结果数据");
    }

    /**
     * 获取投诉工单_投诉赔偿结果详细信息
     */
    @PreAuthorize(hasPermi = "system:reimb:query")
    @GetMapping(value = "/{caseComplaintReimbId}")
    public AjaxResult getInfo(@PathVariable("caseComplaintReimbId") Long caseComplaintReimbId)
    {
        return AjaxResult.success(caseComplaintReimbService.selectCaseComplaintReimbById(caseComplaintReimbId));
    }

    /**
     * 新增投诉工单_投诉赔偿结果
     */
    @PreAuthorize(hasPermi = "system:reimb:add")
    @Log(title = "投诉工单_投诉赔偿结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CaseComplaintReimb caseComplaintReimb)
    {
        return toAjax(caseComplaintReimbService.insertCaseComplaintReimb(caseComplaintReimb));
    }

    /**
     * 修改投诉工单_投诉赔偿结果
     */
    @PreAuthorize(hasPermi = "system:reimb:edit")
    @Log(title = "投诉工单_投诉赔偿结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CaseComplaintReimb caseComplaintReimb)
    {
        return toAjax(caseComplaintReimbService.updateCaseComplaintReimb(caseComplaintReimb));
    }

    /**
     * 删除投诉工单_投诉赔偿结果
     */
    @PreAuthorize(hasPermi = "system:reimb:remove")
    @Log(title = "投诉工单_投诉赔偿结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{caseComplaintReimbIds}")
    public AjaxResult remove(@PathVariable Long[] caseComplaintReimbIds)
    {
        return toAjax(caseComplaintReimbService.deleteCaseComplaintReimbByIds(caseComplaintReimbIds));
    }
}
